#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2018, Niklas Hauser
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------


def init(module):
    module.name = ":driver:ds18b20"
    module.description = """\
# 1-Wire Thermometer

Programmable resolution 1-wire digital thermometer.

The DS18B20 digital thermometer provides 9-bit to 12-bit Celsius
temperature measurements and has an alarm function with non-volatile
user-programmable upper and lower trigger points. The DS18B20
communicates over a 1-Wire bus that by definition requires only one
data line (and ground) for communication with a central microprocessor.

It has an operating temperature range of -55°C to +125°C and is
accurate to ±0.5°C over the range of -10°C to +85°C.

In addition, the DS18B20 can derive power directly from the data line
("parasite power"), eliminating the need for an external power supply.

Features:
- Power Supply Range is 3.0V to 5.5V
- Each device has a unique 64-Bit Serial Code Stored in an On-Board ROM
- Thermometer Resolution is User Selectable from 9 to 12 Bits
- Converts Temperature to 12-Bit Digital Word in 750ms (Max)
"""

def prepare(module, options):
    module.depends(":architecture:1-wire")
    return True

def build(env):
    env.outbasepath = "modm/src/modm/driver/temperature"
    env.copy("ds18b20.hpp")
    env.copy("ds18b20_impl.hpp")
